package com.feidee.bigdata.controller;

import com.feidee.bigdata.service.TestSentinelOpenFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author:CHQ
 * @Date:2020/5/9 17:05
 * @Description
 */
@RestController
public class ConsumerController {
    public static final String INVODE_URL = "http://sentinel-provider/testSentinel";

    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private TestSentinelOpenFeign testSentinelOpenFeign;


   /* @RequestMapping("/testSentinel/{id}")
    public String test(@PathVariable String id) {
        return restTemplate.getForObject(INVODE_URL + "/" + id, String.class);
    }*/

    @RequestMapping("/test/{id}")
    public String testSentinel(@PathVariable(value = "id") String id) {
        return testSentinelOpenFeign.testSentinel(id);
    }

}
